
#include "MultiVariableInterface.h"
#include "Assembly.h"
#include "MooseVariable.h"
#include "FEProblem.h"
#include "SubProblem.h"
#include "SystemBase.h"
#include "MaterialData.h"
#include "ParallelUniqueId.h"
#include "NonlinearSystem.h"

template<>
InputParameters validParams<MultiVariableInterface>()
{
  InputParameters params = emptyInputParameters();

  return params;
}

MultiVariableInterface::MultiVariableInterface(const InputParameters & parameters) :
    _mv_fe_problem(*parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"))
//    _tid(parameters.get<THREAD_ID>("_tid"))
{
	THREAD_ID _tid = parameters.get<THREAD_ID>("_tid");

	std::vector<VariableName> var_name = _mv_fe_problem.getNonlinearSystem().getVariableNames();
	auto &var0 = _mv_fe_problem.getVariable(_tid, var_name[0]);
	_var_order = var0.order();
	_n_equation = var_name.size();
	for (size_t i = 0; i < _n_equation; ++i)
	{
		auto &var = _mv_fe_problem.getStandardVariable(_tid, var_name[i]);
		_variables.push_back(&var);
		if(var.feType() != var0.feType()) mooseError("MultiDGKernel中变量的类型不一致");

		_uh.push_back(&var.sln());
		_uh_neighbor.push_back(&var.slnNeighbor());
		_grad_uh.push_back(&var.gradSln());
		_grad_uh_neighbor.push_back(&var.gradSlnNeighbor());
	}
}
